lastNotNullOfOrNull

inline fun <T, R : Any> Array<out T>.lastNotNullOfOrNull(transform: (T) -> R?): R?(source)
inline fun <T, R : Any> List<T>.lastNotNullOfOrNull(transform: (T) -> R?): R?(source)

Returns the last non-null element produced by transform function or null otherwise. The element is found by iterating the collection in reverse order.


inline fun <T, R : Any> Iterable<T>.lastNotNullOfOrNull(transform: (T) -> R?): R?(source)
inline fun <T, R : Any> Iterator<T>.lastNotNullOfOrNull(transform: (T) -> R?): R?(source)
inline fun <T, R : Any> Sequence<T>.lastNotNullOfOrNull(transform: (T) -> R?): R?(source)

Returns the last non-null element produced by transform function or null otherwise. The element is found by iterating through all elements, capturing the last matching one.